package cn.gson.springboot.model.service;

import cn.gson.springboot.model.dao.ProductClassifyDao;
import cn.gson.springboot.model.mapper.ProductClassifyMapper;
import cn.gson.springboot.model.pojos.Product;
import cn.gson.springboot.model.pojos.ProductClassify;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductClassifyService {
    @Autowired
    ProductClassifyMapper proClassifyMapper;
    ProductClassifyDao productClassifyDao;

    public List<ProductClassify> selectAllProductClassify(){
        return proClassifyMapper.selectAllProductClassify();
    }

    public ProductClassify selectProductById(Integer proId){
        return proClassifyMapper.selectProductById(proId);
    }
    public List<ProductClassify> treeClassify(){
        return proClassifyMapper.treeClassify();
    }

    public void addClassify(ProductClassify classify) {
        productClassifyDao.save(classify);
    }

    public void deleteOne(Integer proId) {
        productClassifyDao.deleteById(proId);
    }
}
